package fw.database.entity;

import java.io.Serializable;

@SuppressWarnings("serial")
public abstract class BaseEntity implements Idable, Serializable {

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		
		if (!getClass().equals(obj.getClass())) {
			return false;
		}
		
		BaseEntity other = (BaseEntity) obj;
		Serializable id = getId();
		Serializable otherId = other.getId();
		
		if (id == null || otherId == null) {
			return false;
		}
		return id.equals(otherId);
	}
}
